﻿using Quartz;

namespace UsingDataDemo.Jobs;

public class CounterJob : IJob
{
    public static readonly JobKey Key = new JobKey(nameof(CounterJob), "data-passing");

    public static int CurrentCounter = 0;

    public async Task Execute(IJobExecutionContext context)
    {
        //CurrentCounter = context.MergedJobDataMap.GetInt("CurrentCounter");
        Console.WriteLine($"From CounterJob, Current counter is {CurrentCounter++}");
        //context.Put(CounterKey, CurrentCounter++);
        //context.MergedJobDataMap.Put(CounterKey, ++CurrentCounter);
        //context.JobDetail.JobDataMap.Put("CurrentCounter", $"");
        //var data = context.MergedJobDataMap;
        await Task.Delay(1000);
    }
}
